package com.cpj.bsyyzx.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cpj.bsyyzx.entity.BedRecord;
import com.cpj.bsyyzx.entity.Meals;
import com.cpj.bsyyzx.mapper.MealsMapper;
import com.cpj.bsyyzx.service.IMealsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 五个臭皮匠
 * @since 2021-04-27
 */
@Service
public class MealsServiceImpl extends ServiceImpl<MealsMapper, Meals> implements IMealsService {

    @Override
    public Page pageList(Page page, Meals meals) {
        if (page == null) {
            page = new Page();
        }
        QueryWrapper wrapper = new QueryWrapper();
        if (meals != null && !StringUtils.isEmpty((meals.getUserName()))) {
            wrapper.like("user_name", meals.getUserName());
        }
        return super.page(page, wrapper);
    }
}
